/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gmao.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Amine
 */
@Entity
@Table(name = "tache_production")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TacheProduction.findAll", query = "SELECT t FROM TacheProduction t"),
    @NamedQuery(name = "TacheProduction.findByNom", query = "SELECT t FROM TacheProduction t WHERE t.nom = :nom"),
    @NamedQuery(name = "TacheProduction.findByDateDebut", query = "SELECT t FROM TacheProduction t WHERE t.dateDebut = :dateDebut"),
    @NamedQuery(name = "TacheProduction.findByDateFin", query = "SELECT t FROM TacheProduction t WHERE t.dateFin = :dateFin"),
    @NamedQuery(name = "TacheProduction.findByIdentifTacheprod", query = "SELECT t FROM TacheProduction t WHERE t.identifTacheprod = :identifTacheprod")})
public class TacheProduction implements Serializable {
    private static final long serialVersionUID = 1L;
    @Size(max = 1)
    @Column(name = "nom")
    private String nom;
    @Column(name = "date_debut")
    @Temporal(TemporalType.DATE)
    private Date dateDebut;
    @Column(name = "date_fin")
    @Temporal(TemporalType.DATE)
    private Date dateFin;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "identif_tacheprod")
    private String identifTacheprod;
    @JoinColumn(name = "identif", referencedColumnName = "identif")
    @ManyToOne
    private Tache identif;
    @OneToMany(mappedBy = "identifTacheprod")
    private List<Tache> tacheList;

    public TacheProduction() {
    }

    public TacheProduction(String identifTacheprod) {
        this.identifTacheprod = identifTacheprod;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public Date getDateDebut() {
        return dateDebut;
    }

    public void setDateDebut(Date dateDebut) {
        this.dateDebut = dateDebut;
    }

    public Date getDateFin() {
        return dateFin;
    }

    public void setDateFin(Date dateFin) {
        this.dateFin = dateFin;
    }

    public String getIdentifTacheprod() {
        return identifTacheprod;
    }

    public void setIdentifTacheprod(String identifTacheprod) {
        this.identifTacheprod = identifTacheprod;
    }

    public Tache getIdentif() {
        return identif;
    }

    public void setIdentif(Tache identif) {
        this.identif = identif;
    }

    @XmlTransient
    public List<Tache> getTacheList() {
        return tacheList;
    }

    public void setTacheList(List<Tache> tacheList) {
        this.tacheList = tacheList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (identifTacheprod != null ? identifTacheprod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TacheProduction)) {
            return false;
        }
        TacheProduction other = (TacheProduction) object;
        if ((this.identifTacheprod == null && other.identifTacheprod != null) || (this.identifTacheprod != null && !this.identifTacheprod.equals(other.identifTacheprod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.gmao.entities.TacheProduction[ identifTacheprod=" + identifTacheprod + " ]";
    }
    
}
